package jianzhiOffer;
//剑指 Offer 56 - I. 数组中数字出现的次数
public class Num56_I_singleNumbers {

    public int[] singleNumbers(int[] nums) {
        int num = 0;
        for (int i : nums){
            num ^= i;
        }
        int div = 1;
        while ((div & num) == 0) {
            div <<= 1;
        }
        int []ret = new int[2];
        for (int i : nums){
            if ((i & div) == 0){
                ret[0] ^= i;
            }else {
                ret[1] ^= i;
            }
        }
        return ret;

    }


}
